﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Prism.Logging;
using NLog;

namespace FM
{
    public class NLog日志 : ILoggerFacade
    {

        private readonly Logger _log;

        public NLog日志()
        {
            if (_log == null)
            {
                _log = LogManager.GetCurrentClassLogger();
            }
        }

        public void Log(string message, Category category, Priority priority)
        {

            switch (category)
            {
                case Category.Debug:
                    _log.Debug(string.Format("[{1}]{0}", message, priority));
                    break;
                case Category.Exception:
                    _log.Error(string.Format("[{1}]{0}", message, priority));
                    break;
                case Category.Info:
                    _log.Info(string.Format("[{1}]{0}", message, priority));
                    break;
                case Category.Warn:
                    _log.Warn(string.Format("[{1}]{0}", message, priority));
                    break;
                default:
                    _log.Info(string.Format("[{1}]{0}", message, priority));
                    break;
            }
        }
    }
}
